<?
session_start();



$PROJECT_DIR = $_SERVER['DOCUMENT_ROOT'] . '/MARKET-HOME/';
require_once $PROJECT_DIR . '/Negocios/Carrinho.php';

$car = new Carrinho();

$resultadoCarrinho = $car->selectCarrinho();

while($row = mysql_fetch_array($resultadoCarrinho)) {

    $qtdCarrinho = $row['quantidade'] ;

}

//      var_dump($result);
//     die("morreu");

//-------------------------------------------- select2
$resultadoCarrinho2 = $car->selectCarrinho2();

while($row = mysql_fetch_array($resultadoCarrinho2)) {

    $valorCompra = $row['preco'] ;

}

//$TotalCarrinho = $qtdCarrinho + $valorCompra;


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
        <style type="text/css">
            <!--
            .style1 {	color: #333333;
                      font-weight: bold;
            }
            .style2 {color: #E5E5E5}
            .style3 {	font-size: 11px;
                      font-family: Arial, Helvetica, sans-serif;
            }
            .style6 {	color: #FFFFFF;
                      font-weight: bold;
            }
            .style7 {color: #333333}
            body {
                margin-left: 0px;
                margin-top: 0px;
                margin-right: 0px;
                margin-bottom: 0px;
            }
            -->
        </style>
    </head>
    <script language=JavaScript>

        function alerta(){
            alert("Efetue o login!");
        }</script>
    <body>
        <table width="179" height="414" border="0">
            <tr>
                <td height="27" colspan="2" bgcolor="#FF0000"><div align="center"><span class="style6">Carrinho de Compras</span></div></td>
            </tr>
            <tr>
                <?php if ($_SESSION['logado'] == "1") {?>
                <td width="77" height="72" bgcolor="#FF0000"><a href="seuCarrinho.php"><img src="images/carrinho2.jpg" width="77" height="65" border="0" /></a></td>
                <?
                }else {
                    echo "<td width='77' height='72' bgcolor='#FF0000'><a href='javascript:alerta()" . "'> <img src='images/carrinho2.jpg"  . "' width='77' height='65' border='0'/> </a></td>";
                }
                ?>
                <td width="92" bgcolor="#FF0000"><div align="center"><span class="style6"><? echo $qtdCarrinho ?> itens no carrinho</span></div></td>
            </tr>
            <tr>
                <td height="21" colspan="2" bgcolor="#FF0000"><span class="style6">Total: R$ <? echo $valorCompra ?> </span></td>
            </tr>
            <tr>
                <td height="21" colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td height="27" colspan="2" bgcolor="#FF0000"><div align="center"><span class="style6">Faça seu login</span></div></td>
            </tr>
            <tr>

                <td colspan="2"><form action="validarCliente.php" method="get">
                        <p align="left"><span class="style7">CPF:</span><span class="style1">
                                <input name="cpfcnpj" size="20"  />
                            </span><span class="style7">Senha:</span><span class="style1">
                                <input name="senha" type="password" size="20" />
                            </span></p>
                        <div align="left">
                            <input type="submit" name="Submit" value="OK" border="gray" />
                            <span class="style2"> .</span>
                            <!------COMEÇA AQUI---------->

                            <script language="JavaScript" type="text/javascript">
                                <!--
                                var U = "formularioCliente.php";

                                var X = 300;
                                var Y = 50;
                                var W = 340;
                                var H = 380;
                                var s="resizable,left="+X+",top="+Y+",screenX="+X+",screenY="+Y+",width="+W+",height="+H;
                                function popMe(){
                                    var SGW = window.open(U,'TheWindow',s)
                                }
                                //   -->
                            </script>
                            <!-- NAO REMOVA A LINHA ABAIXO  -->
                            <a href="javascript:popMe()" class="style3">Ainda não é cadastrado?</a>
                            <!------TERMINA AQUI---------->
                        </div>
                    </form></td>
            </tr>
            <tr>
                <td height="164" colspan="2">&nbsp;</td>
            </tr>
        </table>
    </body>
</html>
